<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    #canvas{
      border: 1px solid black;
    }
  </style>
</head>
<body>
  <canvas id="canvas"></canvas>

  <script>
    const canvas = document.getElementById("canvas");
    let ctx = canvas.getContext("2d");
    console.log(ctx);
    //设置开始路径
    ctx.beginPath();
    //绘制起始点
    ctx.moveTo(50,50);
    //经过的某个位置
    ctx.lineTo(100, 100);
    ctx.closePath();
    ctx.lineTo(100, 60);
    //设置结束路径
    //起始点的样式  round 圆角
    ctx.lineCap = "round";
    //拐点的样式  round 圆角
    // ctx.lineJoin = "round";
    //斜接限制的长度
    ctx.miterLimit = 1
    ctx.lineWidth = 10
    // ctx.fill()
    //挥着路径
    ctx.stroke();
  </script>
</body>
</html>